Skip to content

Replace pip-compile-based dependency management with uv-based approach#1352

Open
mhucka wants to merge 20 commits into
quantumlib:mainfrom
mhucka:use-uv
Open

Replace pip-compile-based dependency management with uv-based approach#1352
mhucka wants to merge 20 commits into
quantumlib:mainfrom
mhucka:use-uv

Conversation

@mhucka

@mhucka mhucka commented Jun 9, 2026

Copy link
Copy Markdown
Collaborator

Replace the Docker file and scripts in dev_tools/requirements with a simpler scheme that uses uv.

@mhucka

mhucka commented Jun 9, 2026

Copy link
Copy Markdown
Collaborator Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request migrates the dependency compilation process from a Docker-based pip-compile setup to a local bash script utilizing uv. It updates the dependency files with Python version markers, regenerates the environment files with hashes, and configures uv in pyproject.toml. The review feedback highlights two key issues: the getopts parser in the new bash script will incorrectly swallow options intended for uv, and a critical lower bound constraint for cirq-core was omitted for Python versions older than 3.11.

Comment thread dev_tools/requirements/create-env-files.sh Outdated
Comment thread dev_tools/requirements/deps/runtime.txt Outdated
mhucka and others added 3 commits June 8, 2026 22:14
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
@mhucka mhucka marked this pull request as ready for review June 9, 2026 05:24
@mhucka mhucka requested a review from pavoljuhas June 9, 2026 05:24

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request replaces the previous Docker-based pip-compile workflow with a faster, uv-based dependency compilation process. It introduces a new script, dev_tools/requirements/create-env-files.sh, updates dependency requirements with environment markers, regenerates the environment lock files with hashes, and configures uv in pyproject.toml. Feedback on the changes highlights a potential Shellcheck warning (SC2086) in the new shell script due to unquoted variables, with a recommendation to use a Bash array to safely handle optional arguments.

Comment thread dev_tools/requirements/create-env-files.sh Outdated
Comment thread dev_tools/requirements/create-env-files.sh Outdated

@pavoljuhas pavoljuhas left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please see inline comments regarding max_compat files, otherwise LGTM.

Also, if all .env.txt files will be only generated by the uv, consider marking them up with the linguist-generated git attribute like here (can be a separate PR).

Comment thread dev_tools/requirements/create-env-files.sh Outdated
# ~~~~ Generate max_compat files ~~~~

uv pip compile "$@" \
-o dev_tools/requirements/max_compat/dev.env.txt \

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this still needed? The output in dev_tools/requirements/max_compat/dev.env.txt is nearly identical to dev_tools/requirements/envs/pytest.env.txt. It appears to be compiled for Python >= 3.12 so the constraints in oldest-versions.txt have no effect.

Comment on lines +102 to +103
uv pip compile "$@" \
-o dev_tools/requirements/max_compat/pytest-max-compat.env.txt \

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like a duplicate of dev_tools/requirements/max_compat/dev.env.txt.
Please fix or delete.

Comment thread dev_tools/requirements/deps/oldest-versions.txt Outdated
Comment thread dev_tools/requirements/deps/runtime.txt
@mhucka

mhucka commented Jun 10, 2026

Copy link
Copy Markdown
Collaborator Author

Also, if all .env.txt files will be only generated by the uv, consider marking them up with the linguist-generated git attribute like here (can be a separate PR).

Thanks for the great idea. Done in PR #1355

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants